package com.aliengen.thingple.driverapp.network;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.Context;
import android.content.SyncResult;
import android.os.Bundle;
import android.util.Log;

import com.activeandroid.query.Select;
import com.aliengen.thingple.driverapp.data.local.EventModel;
import com.aliengen.thingple.driverapp.network.api.ThingpleAPI;
import com.aliengen.thingple.driverapp.network.api.exception.APICallException;
import com.aliengen.thingple.driverapp.service.HandsetApplication;

import org.json.JSONObject;

/**
 * This class is part of the Thingple mobile application for the CMC168 Handheld reader.
 *
 * Copyright AlienGen Limited 2016. All rights reserved.
 *
 * @author Timothé Mermet-Buffet <tim@aliengen.com>
 */
public class DataSyncAdapter  extends AbstractThreadedSyncAdapter {
    private final AccountManager mAccountManager;
    public HandsetApplication mApplication;

    public DataSyncAdapter(Context context, boolean autoInitialize) {
        super(context, autoInitialize);
        mAccountManager = AccountManager.get(context);
        mApplication = (HandsetApplication) context;
    }

    @Override
    public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
        Log.d("DataSyncAdapter", "onPerformSync for account[" + account.name + "]");
        try {
            // Get the auth token for the current account

            // Get next data to synchronize

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
